/*
day257
2020.5.11
*/
#include<map>
#include<vector>
#include<cstdlib> 
using namespace std;

struct ListNode {
    int val;
    ListNode *next;
    ListNode(int x) : val(x), next(NULL) {}
};
struct TreeNode {
    int val;
    TreeNode *left;
    TreeNode *right;
    TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};

class Solution {
public:
    bool isSubPath(ListNode* head, TreeNode* root) {
        if(!root)
        {
        	return false;
		}
		
		if(isequal(head,root))
		{
			return true;
		}
		
		return isSubPath(head,root->left) || isSubPath(head,root->right);
    }
    
    bool isequal(ListNode* head, TreeNode* root)
    {
    	if(!head)
    	{
    		return true;
		}
		
		if(!root)
		{
			return false;
		}
		
		if(head->val != root->val)
		{
			return false;
		}
		
		return isequal(head->next,root->left) || isequal(head->next,root->right);
	}
};

int main()
{
	return 0;
}
